package com.test.daily.leetcode.y2022.m07.day0716.v01;

/**
 * @descriptions:
 * @author: Tom
 * @date: 2022/7/16 上午 09:06
 * @version: 1.0
 */
public class Solution {
    public static class Node {
        int value;
        Node next;

        public Node(int value) {
            this.value = value;
        }
    }

    public Node upOrMidNode(Node head) {
        if (head == null || head.next == null) {
            return null;
        }
        Node slow = head;
        Node fast = head.next;
        while (fast != null && fast.next != null) {
            slow = slow.next;
            fast = fast.next.next;
        }
        return slow;
    }
}
